#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0;
        int right = height.size() - 1;
        vector<int> maxret;
        while (left < right)
        {

            maxret.push_back(min(height[left], height[right]) * (right - left));
            if (height[left] <= height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        sort(maxret.begin(), maxret.end(), greater<int>());
        return maxret.front();
    }
};